import { _decorator, Component, instantiate, Label, log, Node } from 'cc';
import { CommonUtils, MoveDirection } from '../utils/CommonUtils';
import { GlobalRoot } from '../global/GlobalRoot';
import { GlobalManager } from '../global/GlobalManager';
import { AudioManager } from '../managers/AudioManager';
import { UserDate } from '../global/UserDate';
import LoadScrollView from '../utils/LoadScrollView';
const { ccclass, property } = _decorator;

@ccclass('rankScript')
export class rankScript extends Component {
    allNode: any = {}
    start() {
        this.allNode = CommonUtils.getAllChildrenMap(this.node)
        CommonUtils.moveInDir(this.allNode.bg
            ,MoveDirection.Up
            ,0.3,()=>{
        })

    
        CommonUtils.popUp(this.allNode.closeBtn,0.3,0.2)
        this.allNode.ScrollView.getComponent(LoadScrollView).initLocalUi([1,2,3],(p,d)=>{
            let item = instantiate(this.allNode.item)
            item.parent = p 
            item.active = true
            item.getChildByName("rank").getComponent(Label ).string = d
        })
        CommonUtils.add2DClick(this.allNode.closeBtn,(e)=>{
            GlobalRoot.instance.UiManager.closePopup(GlobalManager.popups.rankPop)
        })
        CommonUtils.popUp(this.allNode.closeBtn,0.3,0.2)
        

    }

    
  


    update(deltaTime: number) {

    }
}


